<!--Gordana Pejic 191/01-->
<?php
    $uname=$_GET["uname"];
    $fname=$_POST["fname"];
    $lname=$_POST["lname"];
    $email=$_POST["email"];
    $phone=$_POST["phone"];
    $pass=$_POST["pass"];
    $repass=$_POST["repass"];
    $country=$_POST["country"];
    $city=$_POST["city"];
    require 'db.php';
    $con=  dbConnect('sib');

    if ($fname!="") {
       $result =  mysql_query("UPDATE user SET FirstName='$fname' WHERE UserName='$uname'", $con);
       if (!$result)
           die('Error: ' . mysql_error());
    }
    if ($lname!="") {
       $result =  mysql_query("UPDATE user SET LastName='$lname' WHERE UserName='$uname'", $con);
       if (!$result)
           die('Error: ' . mysql_error());
    }
    if ($email!="") {
       $result = mysql_query("UPDATE user SET Email='$email' WHERE UserName='$uname'", $con);
       if (!$result)
           die('Error: ' . mysql_error());
    }
    if ($phone!="") {
        $result = mysql_query("UPDATE user SET Phone='$phone' WHERE UserName='$uname'", $con);
        if (!$result)
           die('Error: ' . mysql_error());
    }
    if ($country!="") {
        $result = mysql_query("UPDATE user SET Country='$country' WHERE UserName='$uname'", $con);
        if (!$result)
           die('Error: ' . mysql_error());
    }
    if ($city!="") {
       $result = mysql_query("UPDATE user SET City='$city' WHERE UserName='$uname'", $con);
       if (!$result)
           die('Error: ' . mysql_error());
    }
    
    if ($pass!="" && $repass!="" && $pass==$repass) {
        $result = mysql_query("UPDATE user SET Password='$pass' WHERE UserName='$uname'", $con);
        if (!$result)
           die('Error: ' . mysql_error());
    }

    mysql_close($con);
    header('Location: ../index.php');
?>
